﻿namespace Domain
{
    public class Point
    {
        public double x { get; private set; }
        public double y { get; private set; }

        public Point(double x, double y)
        {
            this.x = x;
            this.y = y;
        }
        public override bool Equals(object obj)
        {
            var point = (Point)obj;
            return DoubleComparator.AreEqual(x, point.x) && DoubleComparator.AreEqual(y, point.y);
        }
        public override int GetHashCode()
        {
            return GetHashCode();
        }
        public static bool operator==(Point pointA, Point pointB)
        {
            if(ReferenceEquals(pointA, pointB))
            {
                return true;
            }
            if ((object)pointA == null || (object)pointB == null)
            {
                throw new System.ArgumentNullException();
            }
            return pointA.Equals(pointB);
        }
        public static bool operator!=(Point pointA, Point pointB)
        {
            return !(pointA == pointB);
        }
    }
}
